<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/Public/static/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/Public/static/css/public.css" media="all"/>
    <style>
        /*

    Name:       Base16 Default Light
    Author:     Chris Kempson (http://chriskempson.com)

    CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
    Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)

*/

        .cm-s-tool-light.CodeMirror {
            background: #FFFFFF;
            color: #202020;
            border: 1px solid #abadb3;
            line-height: 1.5;
        }

        .cm-s-tool-light div.CodeMirror-selected {
            background: #e0e0e0;
        }

        .cm-s-tool-light .CodeMirror-line::selection, .cm-s-tool-light .CodeMirror-line > span::selection, .cm-s-tool-light .CodeMirror-line > span > span::selection {
            background: #e0e0e0;
        }

        .cm-s-tool-light .CodeMirror-line::-moz-selection, .cm-s-tool-light .CodeMirror-line > span::-moz-selection, .cm-s-tool-light .CodeMirror-line > span > span::-moz-selection {
            background: #e0e0e0;
        }

        .cm-s-tool-light .CodeMirror-gutters {
            background: #f5f5f5;
        }

        .cm-s-tool-light .CodeMirror-guttermarker {
            color: #ac4142;
        }

        .cm-s-tool-light .CodeMirror-guttermarker-subtle {
            color: #b0b0b0;
        }

        .cm-s-tool-light .CodeMirror-linenumber {
            color: #b0b0b0;
        }

        .cm-s-tool-light .CodeMirror-cursor {
            border-left: 1px solid #505050;
        }

        .cm-s-tool-light span.cm-comment {
            color: #8f5536;
        }

        .cm-s-tool-light span.cm-atom {
            color: #aa759f;
        }

        .cm-s-tool-light span.cm-number {
            color: #aa759f;
        }

        .cm-s-tool-light span.cm-property, .cm-s-tool-light span.cm-attribute {
            color: #90a959;
        }

        .cm-s-tool-light span.cm-keyword {
            color: #ac4142;
        }

        .cm-s-tool-light span.cm-string {
            color: #f4bf75;
        }

        .cm-s-tool-light span.cm-variable {
            color: #90a959;
        }

        .cm-s-tool-light span.cm-variable-2 {
            color: #6a9fb5;
        }

        .cm-s-tool-light span.cm-def {
            color: #d28445;
        }

        .cm-s-tool-light span.cm-bracket {
            color: #202020;
        }

        .cm-s-tool-light span.cm-tag {
            color: #ac4142;
        }

        .cm-s-tool-light span.cm-link {
            color: #aa759f;
        }

        .cm-s-tool-light span.cm-error {
            background: #ac4142;
            color: #505050;
        }

        .cm-s-tool-light span.cm-string {
            color: #C41A16;
        }

        .cm-s-tool-light span.cm-number {
            color: unset;
        }

        .cm-s-tool-light span.cm-keyword {
            color: #AA0D91;
        }

        .cm-s-tool-light span.cm-atom {
            color: unset;
        }

        .cm-s-tool-light span.cm-variable {
            color: #000000;
        }

        .cm-s-tool-light span.cm-def {
            font-style: italic;
        }

        .cm-s-tool-light span.cm-comment {
            color: #007400;
        }

        .cm-s-tool-light span.cm-variable-2 {
            color: #881280;
        }

        .cm-s-tool-light span.cm-property {
            color: unset;
        }

        .cm-s-tool-light span.cm-operator {
            color: #AA0D91;
        }

        .cm-s-tool-light .CodeMirror-activeline-background {
            background: #DDDCDC;
        }

        .cm-s-tool-light .CodeMirror-matchingbracket {
            text-decoration: underline;
            color: white !important;
        }

        /* BASICS */

        .CodeMirror {
            /* Set height, width, borders, and global font properties here */
            font-family: monospace;
            height: 300px;
            color: black;
            direction: ltr;
        }

        /* PADDING */

        .CodeMirror-lines {
            padding: 4px 0; /* Vertical padding around content */
        }

        .CodeMirror pre {
            padding: 0 4px; /* Horizontal padding of content */
        }

        .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
            background-color: white; /* The little square between H and V scrollbars */
        }

        /* GUTTER */

        .CodeMirror-gutters {
            border-right: 1px solid #ddd;
            background-color: #f7f7f7;
            white-space: nowrap;
        }

        .CodeMirror-linenumbers {
        }

        .CodeMirror-linenumber {
            padding: 0 3px 0 5px;
            min-width: 20px;
            text-align: right;
            color: #999;
            white-space: nowrap;
        }

        .CodeMirror-guttermarker {
            color: black;
        }

        .CodeMirror-guttermarker-subtle {
            color: #999;
        }

        /* CURSOR */

        .CodeMirror-cursor {
            border-left: 1px solid black;
            border-right: none;
            width: 0;
        }

        /* Shown when moving in bi-directional text */
        .CodeMirror div.CodeMirror-secondarycursor {
            border-left: 1px solid silver;
        }

        .cm-fat-cursor .CodeMirror-cursor {
            width: auto;
            border: 0 !important;
            background: #7e7;
        }

        .cm-fat-cursor div.CodeMirror-cursors {
            z-index: 1;
        }

        .cm-fat-cursor-mark {
            background-color: rgba(20, 255, 20, 0.5);
            -webkit-animation: blink 1.06s steps(1) infinite;
            -moz-animation: blink 1.06s steps(1) infinite;
            animation: blink 1.06s steps(1) infinite;
        }

        .cm-animate-fat-cursor {
            width: auto;
            border: 0;
            -webkit-animation: blink 1.06s steps(1) infinite;
            -moz-animation: blink 1.06s steps(1) infinite;
            animation: blink 1.06s steps(1) infinite;
            background-color: #7e7;
        }

        @-moz-keyframes blink {
            0% {
            }
            50% {
                background-color: transparent;
            }
            100% {
            }
        }

        @-webkit-keyframes blink {
            0% {
            }
            50% {
                background-color: transparent;
            }
            100% {
            }
        }

        @keyframes blink {
            0% {
            }
            50% {
                background-color: transparent;
            }
            100% {
            }
        }

        /* Can style cursor different in overwrite (non-insert) mode */
        .CodeMirror-overwrite .CodeMirror-cursor {
        }

        .cm-tab {
            display: inline-block;
            text-decoration: inherit;
        }

        .CodeMirror-rulers {
            position: absolute;
            left: 0;
            right: 0;
            top: -50px;
            bottom: -20px;
            overflow: hidden;
        }

        .CodeMirror-ruler {
            border-left: 1px solid #ccc;
            top: 0;
            bottom: 0;
            position: absolute;
        }

        /* DEFAULT THEME */

        .cm-s-default .cm-header {
            color: blue;
        }

        .cm-s-default .cm-quote {
            color: #090;
        }

        .cm-negative {
            color: #d44;
        }

        .cm-positive {
            color: #292;
        }

        .cm-header, .cm-strong {
            font-weight: bold;
        }

        .cm-em {
            font-style: italic;
        }

        .cm-link {
            text-decoration: underline;
        }

        .cm-strikethrough {
            text-decoration: line-through;
        }

        .cm-s-default .cm-keyword {
            color: #708;
        }

        .cm-s-default .cm-atom {
            color: #219;
        }

        .cm-s-default .cm-number {
            color: #164;
        }

        .cm-s-default .cm-def {
            color: #00f;
        }

        .cm-s-default .cm-variable,
        .cm-s-default .cm-punctuation,
        .cm-s-default .cm-property,
        .cm-s-default .cm-operator {
        }

        .cm-s-default .cm-variable-2 {
            color: #05a;
        }

        .cm-s-default .cm-variable-3, .cm-s-default .cm-type {
            color: #085;
        }

        .cm-s-default .cm-comment {
            color: #a50;
        }

        .cm-s-default .cm-string {
            color: #a11;
        }

        .cm-s-default .cm-string-2 {
            color: #f50;
        }

        .cm-s-default .cm-meta {
            color: #555;
        }

        .cm-s-default .cm-qualifier {
            color: #555;
        }

        .cm-s-default .cm-builtin {
            color: #30a;
        }

        .cm-s-default .cm-bracket {
            color: #997;
        }

        .cm-s-default .cm-tag {
            color: #170;
        }

        .cm-s-default .cm-attribute {
            color: #00c;
        }

        .cm-s-default .cm-hr {
            color: #999;
        }

        .cm-s-default .cm-link {
            color: #00c;
        }

        .cm-s-default .cm-error {
            color: #f00;
        }

        .cm-invalidchar {
            color: #f00;
        }

        .CodeMirror-composing {
            border-bottom: 2px solid;
        }

        /* Default styles for common addons */

        div.CodeMirror span.CodeMirror-matchingbracket {
            color: #0b0;
        }

        div.CodeMirror span.CodeMirror-nonmatchingbracket {
            color: #a22;
        }

        .CodeMirror-matchingtag {
            background: rgba(255, 150, 0, .3);
        }

        .CodeMirror-activeline-background {
            background: #e8f2ff;
        }

        /* STOP */

        /* The rest of this file contains styles related to the mechanics of
           the editor. You probably shouldn't touch them. */

        .CodeMirror {
            position: relative;
            overflow: hidden;
            background: white;
        }

        .CodeMirror-scroll {
            overflow: scroll !important; /* Things will break if this is overridden */
            /* 30px is the magic margin used to hide the element's real scrollbars */
            /* See overflow: hidden in .CodeMirror */
            margin-bottom: -30px;
            margin-right: -30px;
            padding-bottom: 30px;
            height: 100%;
            outline: none; /* Prevent dragging from highlighting the element */
            position: relative;
        }

        .CodeMirror-sizer {
            position: relative;
            border-right: 30px solid transparent;
        }

        /* The fake, visible scrollbars. Used to force redraw during scrolling
           before actual scrolling happens, thus preventing shaking and
           flickering artifacts. */
        .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
            position: absolute;
            z-index: 6;
            display: none;
        }

        .CodeMirror-vscrollbar {
            right: 0;
            top: 0;
            overflow-x: hidden;
            overflow-y: scroll;
        }

        .CodeMirror-hscrollbar {
            bottom: 0;
            left: 0;
            overflow-y: hidden;
            overflow-x: scroll;
        }

        .CodeMirror-scrollbar-filler {
            right: 0;
            bottom: 0;
        }

        .CodeMirror-gutter-filler {
            left: 0;
            bottom: 0;
        }

        .CodeMirror-gutters {
            position: absolute;
            left: 0;
            top: 0;
            min-height: 100%;
            z-index: 3;
        }

        .CodeMirror-gutter {
            white-space: normal;
            height: 100%;
            display: inline-block;
            vertical-align: top;
            margin-bottom: -30px;
        }

        .CodeMirror-gutter-wrapper {
            position: absolute;
            z-index: 4;
            background: none !important;
            border: none !important;
        }

        .CodeMirror-gutter-background {
            position: absolute;
            top: 0;
            bottom: 0;
            z-index: 4;
        }

        .CodeMirror-gutter-elt {
            position: absolute;
            cursor: default;
            z-index: 4;
        }

        .CodeMirror-gutter-wrapper ::selection {
            background-color: transparent
        }

        .CodeMirror-gutter-wrapper ::-moz-selection {
            background-color: transparent
        }

        .CodeMirror-lines {
            cursor: text;
            min-height: 1px; /* prevents collapsing before first draw */
        }

        .CodeMirror pre {
            /* Reset some styles that the rest of the page might have set */
            -moz-border-radius: 0;
            -webkit-border-radius: 0;
            border-radius: 0;
            border-width: 0;
            background: transparent;
            font-family: inherit;
            font-size: inherit;
            margin: 0;
            white-space: pre;
            word-wrap: normal;
            line-height: inherit;
            color: inherit;
            z-index: 2;
            position: relative;
            overflow: visible;
            -webkit-tap-highlight-color: transparent;
            -webkit-font-variant-ligatures: contextual;
            font-variant-ligatures: contextual;
        }

        .CodeMirror-wrap pre {
            word-wrap: break-word;
            white-space: pre-wrap;
            word-break: normal;
        }

        .CodeMirror-linebackground {
            position: absolute;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
            z-index: 0;
        }

        .CodeMirror-linewidget {
            position: relative;
            z-index: 2;
            padding: 0.1px; /* Force widget margins to stay inside of the container */
        }

        .CodeMirror-widget {
        }

        .CodeMirror-rtl pre {
            direction: rtl;
        }

        .CodeMirror-code {
            outline: none;
        }

        /* Force content-box sizing for the elements where we expect it */
        .CodeMirror-scroll,
        .CodeMirror-sizer,
        .CodeMirror-gutter,
        .CodeMirror-gutters,
        .CodeMirror-linenumber {
            -moz-box-sizing: content-box;
            box-sizing: content-box;
        }

        .CodeMirror-measure {
            position: absolute;
            width: 100%;
            height: 0;
            overflow: hidden;
            visibility: hidden;
        }

        .CodeMirror-cursor {
            position: absolute;
            pointer-events: none;
        }

        .CodeMirror-measure pre {
            position: static;
        }

        div.CodeMirror-cursors {
            visibility: hidden;
            position: relative;
            z-index: 3;
        }

        div.CodeMirror-dragcursors {
            visibility: visible;
        }

        .CodeMirror-focused div.CodeMirror-cursors {
            visibility: visible;
        }

        .CodeMirror-selected {
            background: #d9d9d9;
        }

        .CodeMirror-focused .CodeMirror-selected {
            background: #d7d4f0;
        }

        .CodeMirror-crosshair {
            cursor: crosshair;
        }

        .CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection {
            background: #d7d4f0;
        }

        .CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection {
            background: #d7d4f0;
        }

        .cm-searching {
            background-color: #ffa;
            background-color: rgba(255, 255, 0, .4);
        }

        /* Used to force a border model for a node */
        .cm-force-border {
            padding-right: .1px;
        }

        @media print {
            /* Hide the cursor when printing */
            .CodeMirror div.CodeMirror-cursors {
                visibility: hidden;
            }
        }

        /* See issue #2901 */
        .cm-tab-wrap-hack:after {
            content: '';
        }

        /* Help users use markselection to safely style text background */
        span.CodeMirror-selectedtext {
            background: none;
        }

        .CodeMirror {
            border: 1px solid #abadb3;
            font-size: 13px;
            line-height: 1.5;
            height: 461px;
        }

        .cm-s-tool-light.CodeMirror {
            background: #FFFFFF;
        }

    </style>
</head>
<body class="childrenBody">
<div class="layui-row">
    <div class="layui-col-md5">
        <div class="row">
            <div class="layui-col-md12">
                <form action="" class="layui-form layui-form-pane" style="border: 1px dashed #aaa;padding: 10px;">
                    <div class="layui-form-item">
                        <lable class="layui-form-label" for="table">选择表 <b style="color: red">*</b></lable>
                        <div class="layui-input-block">
                            <select name="table" lay-filter="table" lay-search lay-verify="required" lay-vertype="tips"
                                    id="table">
                                <option value="">请选择表</option>
                                <volist name="list" id="v">
                                    <option value="{$v}">{$v}</option>
                                </volist>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">控制器名 <b style="color: red">*</b></label>
                        <div class="layui-input-block">
                            <input type="text" title="" name="controller" placeholder="控制器名" lay-verify="required"
                                    class="layui-input" lay-vertype="tips">
                        </div>
                    </div>
                    <div class="layui-form-item">
                    <label class="layui-form-label">功能选择 </label>
                    <div class="layui-input-block">
                        <input class="list" type="checkbox" name="list[]" lay-skin="primary" title="查询" value="select" checked>
                        <input class="list" type="checkbox" name="list[]" lay-skin="primary" title="增加" value="add" checked>
                        <input class="list" type="checkbox" name="list[]" lay-skin="primary" title="修改" value="edit" checked>
                        <input class="list" type="checkbox" name="list[]" lay-skin="primary" title="删除" value="delete" checked>
                    </div>
                </div>
                    <div class="layui-form-item" id="where">
                        <label class="layui-form-label">查询扩展 </label>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否覆盖</label>
                        <div class="layui-input-block">
                            <input type="checkbox" title="" name="over" value="true" lay-skin="switch"
                                    lay-text="覆盖|不覆盖">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">开启锁定</label>
                        <div class="layui-input-block">
                            <input type="checkbox" title="" name="lock" value="true" lay-skin="switch" lay-text="锁定|不锁定"
                                    checked>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button type="submit" lay-submit lay-filter="ajaxsubmit" class="layui-btn layui-btn-green">
                                创建控制器
                            </button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class="row">
            <div class="layui-col-md12 " style="margin-top: 20px;">
                <div class="CodeMirror CodeMirror-wrap cm-s-tool-light" style="height: 100%;">
                    <div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 82.3333px; left: 199px;">
                        <textarea autocorrect="off" autocapitalize="off" spellcheck="false"
                                style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"
                                tabindex="2"></textarea></div>
                    <div class="CodeMirror-vscrollbar" cm-not-content="true">
                        <div style="min-width: 1px; height: 0px;"></div>
                    </div>
                    <div class="CodeMirror-hscrollbar" cm-not-content="true">
                        <div style="height: 100%; min-height: 1px; width: 0px;"></div>
                    </div>
                    <div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div>
                    <div class="CodeMirror-gutter-filler" cm-not-content="true"></div>
                    <div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 30px; margin-bottom: -17px; border-right-width: 13px; min-height: 433px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre><div class="CodeMirror-linenumber CodeMirror-gutter-elt"><div>21</div></div></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-cursors" style="visibility: hidden;"><div class="CodeMirror-cursor" style="left: 650.469px; top: 406px; height: 19.3333px;">&nbsp;</div></div><div class="CodeMirror-code" role="presentation" style=""><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">1</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-keyword">CREATE</span> <span class="cm-keyword">TABLE</span> <span class="cm-variable-2">`xman_test`</span> (</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">2</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-variable-2">`id`</span> <span class="cm-builtin">int</span>(<span class="cm-number">10</span>) <span class="cm-builtin">unsigned</span> <span class="cm-keyword">NOT</span> <span class="cm-atom">NULL</span> <span class="cm-keyword">AUTO_INCREMENT</span> <span class="cm-keyword">COMMENT</span> <span class="cm-string">'ID'</span>,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">3</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-variable-2">`week`</span> <span class="cm-keyword">enum</span>(<span class="cm-string">'monday'</span>,<span class="cm-string">'tuesday'</span>,<span class="cm-string">'wednesday'</span>) <span class="cm-keyword">NOT</span> <span class="cm-atom">NULL</span> <span class="cm-keyword">DEFAULT</span> <span class="cm-string">'monday'</span> <span class="cm-keyword">COMMENT</span> <span class="cm-string">'星期:monday=星期一,tuesday=星期二,wednesday=星期三'</span>,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">4</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-variable-2">`genderdata`</span> <span class="cm-keyword">enum</span>(<span class="cm-string">'male'</span>,<span class="cm-string">'female'</span>) <span class="cm-keyword">NOT</span> <span class="cm-atom">NULL</span> <span class="cm-keyword">DEFAULT</span> <span class="cm-string">'male'</span> <span class="cm-keyword">COMMENT</span> <span class="cm-string">'性别:male=男,female=女'</span>,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">5</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-variable-2">`textarea`</span> <span class="cm-builtin">text</span> <span class="cm-keyword">NOT</span> <span class="cm-atom">NULL</span> <span class="cm-keyword">COMMENT</span> <span class="cm-string">'内容'</span>,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">6</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-variable-2">`image`</span> <span class="cm-builtin">varchar</span>(<span class="cm-number">100</span>) <span class="cm-keyword">NOT</span> <span class="cm-atom">NULL</span> <span class="cm-keyword">DEFAULT</span> <span class="cm-string">''</span> <span class="cm-keyword">COMMENT</span> <span class="cm-string">'图片'</span>,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">7</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-variable-2">`attachfile`</span> <span class="cm-builtin">varchar</span>(<span class="cm-number">100</span>) <span class="cm-keyword">NOT</span> <span class="cm-atom">NULL</span> <span class="cm-keyword">DEFAULT</span> <span class="cm-string">''</span> <span class="cm-keyword">COMMENT</span> <span class="cm-string">'附件'</span>,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">8</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-variable-2">`keywords`</span> <span class="cm-builtin">varchar</span>(<span class="cm-number">100</span>) <span class="cm-keyword">NOT</span> <span class="cm-atom">NULL</span> <span class="cm-keyword">DEFAULT</span> <span class="cm-string">''</span> <span class="cm-keyword">COMMENT</span> <span class="cm-string">'关键字'</span>,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">9</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-variable-2">`price`</span> <span class="cm-builtin">float</span>(<span class="cm-number">10</span>,<span class="cm-number">2</span>) <span class="cm-builtin">unsigned</span> <span class="cm-keyword">NOT</span> <span class="cm-atom">NULL</span> <span class="cm-keyword">DEFAULT</span> <span class="cm-string">'0.00'</span> <span class="cm-keyword">COMMENT</span> <span class="cm-string">'价格'</span>,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">10</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-variable-2">`startdate`</span> <span class="cm-builtin">date</span> <span class="cm-keyword">NOT</span> <span class="cm-atom">NULL</span> <span class="cm-keyword">COMMENT</span> <span class="cm-string">'开始日期'</span>,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">11</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-variable-2">`activitytime`</span> <span class="cm-builtin">datetime</span> <span class="cm-keyword">NOT</span> <span class="cm-atom">NULL</span> <span class="cm-keyword">COMMENT</span> <span class="cm-string">'活动时间(datetime)'</span>,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">12</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-variable-2">`year`</span> <span class="cm-builtin">year</span>(<span class="cm-number">4</span>) <span class="cm-keyword">NOT</span> <span class="cm-atom">NULL</span> <span class="cm-keyword">COMMENT</span> <span class="cm-string">'年'</span>,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">13</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-variable-2">`times`</span> <span class="cm-builtin">time</span> <span class="cm-keyword">NOT</span> <span class="cm-atom">NULL</span> <span class="cm-keyword">COMMENT</span> <span class="cm-string">'时间'</span>,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">14</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-variable-2">`switch`</span> <span class="cm-builtin">tinyint</span>(<span class="cm-number">1</span>) <span class="cm-keyword">NOT</span> <span class="cm-atom">NULL</span> <span class="cm-keyword">DEFAULT</span> <span class="cm-string">'1'</span> <span class="cm-keyword">COMMENT</span> <span class="cm-string">'上架状态:0=下架,1=正常'</span>,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">15</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-variable-2">`ttswitch`</span> <span class="cm-builtin">tinyint</span>(<span class="cm-number">1</span>) <span class="cm-keyword">NOT</span> <span class="cm-atom">NULL</span> <span class="cm-keyword">DEFAULT</span> <span class="cm-string">'0'</span> <span class="cm-keyword">COMMENT</span> <span class="cm-string">'开关:0=OFF,1=ON'</span>,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">16</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-variable-2">`teststate`</span> <span class="cm-keyword">set</span>(<span class="cm-string">'1'</span>,<span class="cm-string">'2'</span>,<span class="cm-string">'3'</span>) <span class="cm-keyword">NOT</span> <span class="cm-atom">NULL</span> <span class="cm-keyword">DEFAULT</span> <span class="cm-string">'1'</span> <span class="cm-keyword">COMMENT</span> <span class="cm-string">'测试复选:1=选项1,2=选项2,3=选项3,'</span>,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">17</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-variable-2">`test2state`</span> <span class="cm-keyword">set</span>(<span class="cm-string">'0'</span>,<span class="cm-string">'1'</span>,<span class="cm-string">'2'</span>) <span class="cm-keyword">DEFAULT</span> <span class="cm-string">'2'</span> <span class="cm-keyword">COMMENT</span> <span class="cm-string">'爱好:0=唱歌,1=跳舞,2=嫖娼'</span>,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">18</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-variable-2">`editor_content`</span> <span class="cm-builtin">text</span> <span class="cm-keyword">COMMENT</span> <span class="cm-string">'富文本'</span>,</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">19</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">PRIMARY</span> <span class="cm-keyword">KEY</span> (<span class="cm-variable-2">`id`</span>),</span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">20</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-keyword">UNIQUE</span> <span class="cm-keyword">KEY</span> <span class="cm-variable-2">`test`</span> (<span class="cm-variable-2">`keywords`</span>) <span class="cm-keyword">USING</span> <span class="cm-keyword">BTREE</span></span></pre></div><div style="position: relative;"><div class="CodeMirror-gutter-wrapper" style="left: -30px;"><div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 21px;">21</div></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">) <span class="cm-keyword">ENGINE</span>=<span class="cm-keyword">InnoDB</span> <span class="cm-keyword">AUTO_INCREMENT</span>=<span class="cm-number">32</span> <span class="cm-keyword">DEFAULT</span> <span class="cm-string-2">CHARSET</span>=utf8 <span class="cm-keyword">ROW_FORMAT</span>=COMPACT <span class="cm-keyword">COMMENT</span>=<span class="cm-string">'测试表'</span>;</span></pre></div></div></div></div></div></div><div style="position: absolute; height: 13px; width: 1px; border-bottom: 0px solid transparent; top: 433px;"></div><div class="CodeMirror-gutters" style="height: 446px; left: -3.8147e-06px;"><div class="CodeMirror-gutter CodeMirror-linenumbers" style="width: 29px;"></div><div class="CodeMirror-gutter CodeMirror-foldgutter"></div></div></div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="layui-col-md12">
                <blockquote class="layui-elem-quote">
                    <span style="color: #da550b;font-weight: bolder">测试控制器</span>为上述SQL代码对应的数据表控制器，无任何修改
                </blockquote>
            </div>
        </div>
    </div>
    <div class="layui-col-md6 " style="margin-left: 20px;">
        <div class="layui-row">
            <div class="layui-col-md12" style="padding: 10px;border: 1px dashed #aaa">
                <blockquote class="layui-elem-quote">
                    <ol start="0">
                        <li>0.所有字段必须有<span class="layui-red">注释，注释为字段的名字，特殊字段有特殊注释格式</span></li>
                        <li>1.radio、select、checkbox、switch控件注释格式 <span class="layui-blue">状态名:1=xx,2=xx</span></li>
                        <li id="t2">
                            2.radio，select，checkbox类型建议使用，<span class="layui-red">数字 </span>标识不同状态而非字符串
                        </li>
                        <li>3.为了更好的区分radio,checkbox,select需要使用set,enum数据类型，生成成功后可手动将数据类型改为tinyint或者int系类型，前提是遵循<a
                                href="#t2">上一条</a>规则
                        </li>
                        <li>4.switch控件比较特殊，值只能为0或者1，且1代表选中，也是就 <span class="layui-badge layui-btn-green">ON</span> 状态</li>
                        <li>5.默认初始控件都是text输入框</li>
                        <li>6.字段是否允许 <span class="layui-red">NULL</span> 决定字段的required校验</li>
                        <li>7.查询扩展功能需要功能选择中的查询被选中</li>
                        <li>8.查询条件默认为查询条件包括所有select,radio,switch的状态以及主键(建议使用ID)字段的输入框</li>
                        <li>9.选择表后查询拓展会加载字段，选择字段及是否模糊，可添加条件</li>
                        <li>10.<span class="layui-red">新!</span>新增其他表主键作为数据列，注释格式如下 xx:外联表的主键:外联表的显示字段(一般为title,name等,可以是外联表中的任意字段)  eg: 文章表中的分类列，列名 <span class="layui-red">category_id</span> 注释 <span class="layui-red">所属分类:id:title</span>更多注意事项请查看<span class="layui-red"><a
                                href="#selid" style="color: dodgerblue;">主键控件</a></span></li>
                    </ol>
                </blockquote>
                <table class="layui-table">
                    <thead class="layui-table-header">
                    <tr>
                        <th width="30%">控件类型</th>
                        <th>情况</th>
                    </tr>
                    </thead>
                    <tbody class="layui-table-body">
                    <tr>
                        <td rowspan="2">select控件</td>
                        <td>
                            数据类型为 <span class="layui-red">enum</span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            数据类型为 <span class="layui-red">set</span>
                        </td>
                    </tr>
                    <tr>
                        <td rowspan="5">datetime日期选择框 本质是输入框，根据类型不同，加载的日期选择级别不同</td>
                        <td>
                            数据类型为 <span class="layui-red">year</span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            数据类型为 <span class="layui-red">date</span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            数据类型为 <span class="layui-red">time</span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            数据类型为 <span class="layui-red">datetime</span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            数据类型为 <span class="layui-red">timestamp</span>
                        </td>
                    </tr>
                    <tr>
                        <td rowspan="5">textarea 控件</td>
                        <td>
                            数据类型为 <span class="layui-red">longtext</span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            数据类型为 <span class="layui-red">text</span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            数据类型为 <span class="layui-red">mediumtext</span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            数据类型为 <span class="layui-red">smalltext</span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            数据类型为 <span class="layui-red">tinytext</span>
                        </td>
                    </tr>
                    <tr>
                        <td rowspan="2">number输入框，小数点长度决定步进属性</td>
                        <td>
                            数据类型为 <span class="layui-red">bigint</span>，<span class="layui-red">int</span>，<span
                                class="layui-red">mediumint</span>，<span class="layui-red">smallint</span>，<span
                                class="layui-red">tinyint</span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            数据类型为 <span class="layui-red">decimal</span>，<span class="layui-red">double</span>，<span
                                class="layui-red">float</span>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center">
                            <span class="layui-red">
                                字段名与数据类型共同决定控件，优先级高于数据类型
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            datetime控件
                        </td>
                        <td>
                            以 <span class="layui-red">time</span>, <span class="layui-red">date</span>结尾的字段
                        </td>
                    </tr>
                    <tr>
                        <td>
                            radio单选框
                        </td>
                        <td>
                            以 <span class="layui-red">data</span>, <span class="layui-red">state</span>, <span
                                class="layui-red">status</span>结尾的且数据类型为 <span style="color: orangered">enum</span> 的字段
                        </td>
                    </tr>
                    <tr>
                        <td>
                            checkbox复选框
                        </td>
                        <td>
                            以 <span class="layui-red">data</span>, <span class="layui-red">state</span>, <span
                                class="layui-red">status</span>结尾的且数据类型为 <span style="color: orangered">set</span> 的字段
                        </td>
                    </tr>
                    <tr>
                        <td>
                            switch开关(默认0代表OFF,1代表ON)OFF与ON可通过注释更改，注释格式参考左侧demo
                        </td>
                        <td>
                            以 <span class="layui-red">switch</span> 结尾的且数据类型为 <span
                                style="color: orangered">tinyint</span> 的字段
                        </td>
                    </tr>
                    <tr>
                        <td>
                            图片上传(jpg,gif,png等主流格式)
                        </td>
                        <td>
                            以 <span class="layui-red">image</span>, <span class="layui-red">images</span>, <span
                                class="layui-red">avatar</span>, <span class="layui-red">avatars</span>结尾的且数据类型为 <span
                                style="color: orangered">varchar</span>, <span style="color: orangered">char</span> 的字段
                        </td>
                    </tr>
                    <tr>
                        <td>
                            文件上传(格式不限)
                        </td>
                        <td>
                            以 <span class="layui-red">file</span>, <span class="layui-red">files</span> 结尾的且数据类型为 <span
                                style="color: orangered">varchar</span>, <span style="color: orangered">char</span> 的字段
                        </td>
                    </tr>
                    <tr>
                        <td>
                            富文本编辑器
                        </td>
                        <td>
                            以 <span class="layui-red">content</span>, <span class="layui-red">description</span> 结尾的且数据类型为 <span
                                style="color: orangered">text</span>,系列的字段
                        </td>
                    </tr>
                    <tr>
                        <td>
                            color颜色选择控件 IE不支持 默认text
                        </td>
                        <td>
                            以 <span class="layui-red">color</span> 结尾的且数据类型为 <span style="color: orangered">varchar</span>,<span style="color: orangered">char</span>的字段
                        </td>
                    </tr>
                    <tr>
                        <td id="selid">
                            <span class="layui-red">主键控件</span>
                        </td>
                        <td>
                            以 <span class="layui-red">_id</span> 结尾的且数据类型为 <span style="color: orangered">int</span>系列的字段<br>
                            其他要求:<br>
                            1.字段名必须为 <span class="layui-red">表名_id</span> 无需表名前缀，表名以及字段名严格遵守thinkphp3.2.3规范，不可使用驼峰法命名。<br>
                            2.注释格式    <strong><span style="color: #dd4444">字段名</span>:<span style="color: #000d4d">id</span>:<span style="color: #007400">xx</span></strong>
                            <br>
                            <span style="color: #dd4444">字段名</span>为该字段(表名_id)在表中的代表意义<br>
                            <span style="color: #000d4d">id</span>为外联表的主键（不一定是id,但必须是主键）<br>
                            <span style="color: #007400">xx</span>为外联表展示的字段(一般为name、title等)
                            <br>
                            3.该字段的not null 不仅决定该字段是否必填，还决定该外联表的join方式。如果必填则inner 非必填 left
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="/Public/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/Public/static/layui/layui.js"></script>
<script type="text/javascript">
    layui.use(['form', 'layer'], function () {
        let form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer;
        form.on('select(table)', function (e) {

            $.post("/admin/makecode/getwherelist",{'table':e.value},function(data){
                let where = $('#where');
                where.html('<label class="layui-form-label">查询扩展 </label>');
                if (data.length > 0) {
                    for (let i=0;i < data.length;i++) {
                        where.append('<div class="layui-input-block">\n' +
                            '                            <input class="wherelist" type="checkbox" name="'+data[i].column_name+'" lay-skin="primary" title="'+data[i].column_name+'" value="'+data[i].column_name+'">\n' +
                            '                            <input class="list" type="checkbox" name="'+data[i].column_name+'_like" lay-skin="primary" title="模糊搜索" value="like">\n' +
                            '                        </div>')
                    }
                    form.render('checkbox');
                }
            });

            let con = e.value.split('_').join('');
            $("input[name=controller]").val(titleCase(con));
        });

        form.on("submit(ajaxsubmit)", function (data) {
            let index = layer.msg('后台程序努力工作中，请稍候', {icon: 16, time: false});
            let list = '';

            $('input.list:checked').each(function(n,r){
                list += $(r).val() + ',';
            });

            let where = '';
            //拼装模糊搜索条件
            $('.wherelist').each(function(index,e){
                let _this = $(e);
                let like = 'eq';
                if (_this.prop('checked')) {
                    if($('input[name='+_this.prop('name')+'_like]').prop('checked')){
                        like = 'like';
                    }
                    where += _this.val() + '=' + like + '&';
                }
            });
            $.post("/admin/Makecode/make", {
                'controller': $('input[name=controller]').val(),
                'table': $("select[name=table]").val(),
                'over': $('input[name=over]:checked').val(),
                'lock': $('input[name=lock]:checked').val(),
                'list': list,
                'where': where,
            }, function (res) {
                layer.close(index);
                if (0 === res.code) {
                    layer.alert(res.info, {icon: 1, 'title': '成功'});
                } else {
                    layer.alert(res.info, {icon: 2, 'title': '失败'});
                }
            });
            return false;
        });

        function titleCase(str) {
            let array = str.toLowerCase().split(" ");
            for (let i = 0; i < array.length; i++) {
                array[i] = array[i][0].toUpperCase() + array[i].substring(1, array[i].length);
            }
            let string;
            string = array.join(" ");
            return string;
        }
    })
</script>
</body>
</html>